//
//  pushDatamodel.m
//  YaoHeAPP
//
//  Created by xyh on 15/12/19.
//  Copyright © 2015年 mac. All rights reserved.
//

#import "pushDatamodel.h"

@implementation pushDatamodel

-(id)initWith:(NSDictionary*)dic
{
    self = [super init];
    if (self)
    {
        self.ID=[dic[@"ID"] integerValue];
        self.publisher=dic[@"Publisher"];
        self.receivertype=[dic[@"ReceiverType"] integerValue];
        self.To=dic[@"To"];
        self.notification=dic[@"Notification"];
        self.Description=dic[@"Description"];
        self.happentime=[dic[@"HappenTime"] integerValue];
        self.type=[dic[@"Type"] integerValue];
        self.data=dic[@"Data"];
    }
    return self;
}


+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString {
    if (jsonString == nil) {
        return nil;
    }
    
    NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
    NSError *err;
    NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
                                                        options:NSJSONReadingMutableContainers
                                                          error:&err];
    if(err) {
        return nil;
    }
    return dic;
}


@end
